From 4aa0d168652a629c3596015b6a9faaeb589ba4d1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 3 Nov 2014 00:48:42 -0500 Subject: [PATCH] Only warn once if inhibit-related dbus calls fail No need to spam about it. https://bugzilla.gnome.org/show_bug.cgi?id=734140 --- gtk/gtkapplication-dbus.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c index 45136b0d86..0c454478ae 100644 --- a/gtk/gtkapplication-dbus.c +++ b/gtk/gtkapplication-dbus.c @@ -334,6 +334,7 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl *impl, GVariant *res; GError *error = NULL; guint cookie; + static gboolean warned = FALSE; if (dbus->sm_proxy == NULL) return 0; @@ -352,7 +353,11 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl *impl, if (error) { - g_warning ("Calling Inhibit failed: %s", error->message); + if (!warned) + { + g_warning ("Calling Inhibit failed: %s", error->message); + warned = TRUE; + } g_error_free (error); return 0; } @@ -390,6 +395,7 @@ gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl *impl, GVariant *res; GError *error = NULL; gboolean inhibited; + static gboolean warned = FALSE; if (dbus->sm_proxy == NULL) return FALSE; @@ -403,7 +409,11 @@ gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl *impl, &error); if (error) { - g_warning ("Calling IsInhibited failed: %s", error->message); + if (!warned) + { + g_warning ("Calling IsInhibited failed: %s", error->message); + warned = TRUE; + } g_error_free (error); return FALSE; } -- 2.30.2